package com.atguigu.day04.test;

import java.util.Scanner;

public class Morning {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的分数:");
        int grade = sc.nextInt();

        String rate = switch (grade / 10) {
            case 10, 9 -> "A";
            case 8 -> "B";
            case 7 -> "C";
            case 6 -> "D";
            case 5, 4, 3, 2, 1, 0 -> "E";
            default -> "您的输入有误";
        };
        System.out.println("您的成绩评级为: " + rate);


        System.out.println("请输入年份:");
        int year = sc.nextInt();
        System.out.println("请输入月份:");
        int month = sc.nextInt();
        int result = switch (month) {
            case 1, 3, 5, 7, 8, 10, 12 -> 31;
            case 4, 6, 9, 11 -> 30;
            case 2 -> (year % 400 ==0 || year % 4 == 0 && year % 100 != 0) ? 29 : 28;
            /*case 2 -> {
                if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                    yield "29";
                } else {
                    yield "28";
                }
            }*/
            default -> 0;
        };
        if (month > 0 && month <= 12) {
            System.out.println(year + "年的" + month + "月有" + result + "天");
        } else {
            System.out.println("月份输入有误");
        }
        sc.close();
    }
}
